/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.biz.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://eladmin.vip
* @description /
* @author Admin
* @date 2023-02-17
**/
@Entity
@Data
@Table(name="hj_fresh_air_ventilator")
public class FreshAirVentilator implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`name`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "名称")
    private String name;

    @Column(name = "`ip`",nullable = false)
    @NotBlank
    @ApiModelProperty(value = "新风设备ip")
    private String ip;

    @Column(name = "`lab_id`",nullable = false)
    @NotNull
    @ApiModelProperty(value = "实验室")
    private String labId;

    @Column(name = "`temperature`")
    @ApiModelProperty(value = "进风口温度")
    private Float temperature;

    @Column(name = "`humidity`")
    @ApiModelProperty(value = "进风口湿度")
    private Float humidity;

    @Column(name = "`status`")
    @ApiModelProperty(value = "故障状态")
    private Integer status;

    @Column(name = "`lack_wind`")
    @ApiModelProperty(value = "缺风状态")
    private Integer lackWind;

    @Column(name = "`transducer`")
    @ApiModelProperty(value = "运行变频")
    private Float transducer;

    @Column(name = "`electrically_operated_valve`")
    @ApiModelProperty(value = "新风电动阀")
    private Integer electricallyOperatedValve;

    @Column(name = "`error_message`")
    @ApiModelProperty(value = "报警信息")
    private String errorMessage;

    @Column(name = "`created_at`")
    @CreationTimestamp
    @ApiModelProperty(value = "createdAt")
    private Timestamp createdAt;

    @Column(name = "`updated_at`")
    @UpdateTimestamp
    @ApiModelProperty(value = "updatedAt")
    private Timestamp updatedAt;

    @Column(name = "`is_deleted`")
    @ApiModelProperty(value = "是否删除")
    private Integer isDeleted;

    @Column(name = "`floor`")
    @ApiModelProperty(value = "所在楼层")
    private Integer floor;

    @Column(name = "`pressure`")
    @ApiModelProperty(value = "压力")
    private float pressure;

    @Column(name = "`amount`")
    @ApiModelProperty(value = "风量")
    private float amount;

    @Column(name = "`is_open`")
    @ApiModelProperty(value = "启停状态")
    private Integer isOpen;

    @Column(name = "`indoor_temperature`")
    @ApiModelProperty(value = "室内温度")
    private Float indoorTemperature;

    @Column(name = "`ambient_temperature`")
    @ApiModelProperty(value = "环境温度")
    private Float ambientTemperature;

    @Column(name = "`address`")
    @ApiModelProperty(value = "地址")
    private String address;

    public void copy(FreshAirVentilator source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
